package com.yty.demo._10_annotation;

import java.lang.reflect.Method;

/**
 * @author: yangtaoyao
 * @time: 2020/1/16 15:06
 * @description: 自定义注解使用
 */
@AnnotationTest(name = "Test",array = {})
public class Test {
    public static void main(String[] args) {
        Test test=new Test();
        Class c=test.getClass();
        if(c.isAnnotationPresent(AnnotationTest.class)){
            System.out.println("Test类上配置了AnnotationTest注解！");
        AnnotationTest annotationTest= (AnnotationTest) c.getAnnotation(AnnotationTest.class);
        System.out.println("name："+ annotationTest.name()+
                ",array:"+annotationTest.array()+
                ",age"+annotationTest.age());
        }else{
            System.out.println("没有配置AnnotationTest注解！");
        }
    }
}
